import { View, Text } from '@tarojs/components'
import './CheckPlace.less'
import Taro from '@tarojs/taro'
import http from '../../store/http'
import { useReady  } from '@tarojs/taro'
import {useState} from 'react'

function CheckPlace(){

    const toorgan=(id)=>{
        Taro.reLaunch({
            url: '/pages/organ/Organ?org_id='+id
          })
    }

    const [data,setData]=useState([]);
    const [org_id,setOrg_id]=useState('');

    useReady(()=>{
        http({
            url:'/findAllOrganization',
            header:{
                'content-type':'application/json'
            }
        }).then((res)=>{
            console.log(res);
            setData(res);
        })
    })

    return (
        <View>
            <View class="vbox">
                <View class="leftbtn">按销量降序</View>
                <View class="rightbtn">筛选</View>
            </View>
            <View>
            <View class="listbox">
                {data && data.map((v,i)=>(<View onClick={toorgan.bind(this,v.org_id)} class="leftbox">
                    <image class="img1" src={v.org_image}></image>
                    <Text class="text1">{v.org_name}</Text>
                    <Text>{v.org_people}</Text>
                </View>))}
                {/* <View onClick={toorgan} class="leftbox">
                    <image class="img1" src="../../public/img/xx.png"></image>
                    <Text class="text1">南方医科大学附属第三医院</Text>
                    <Text>120 人预约</Text>
                </View>
                <View onClick={toorgan} class="rightbox">
                <image class="img1" src="../../public/img/xx.png"></image>
                    <Text class="text1">南方医科大学附属第三医院</Text>
                    <Text>120 人预约</Text>
                </View> */}
            </View>
            {/* <View class="listbox">
                <View onClick={toorgan} class="leftbox">
                    <image class="img1" src="../../public/img/xx.png"></image>
                    <Text class="text1">南方医科大学附属第三医院</Text>
                    <Text>120 人预约</Text>
                </View>
                <View onClick={toorgan} class="rightbox">
                <image class="img1" src="../../public/img/xx.png"></image>
                    <Text class="text1">南方医科大学附属第三医院</Text>
                    <Text>120 人预约</Text>
                </View>
            </View> */}
            {/* <View class="listbox">
                <View onClick={toorgan} class="leftbox">
                    <image class="img1" src="../../public/img/xx.png"></image>
                    <Text class="text1">南方医科大学附属第三医院</Text>
                    <Text>120 人预约</Text>
                </View>
                <View onClick={toorgan} class="rightbox">
                <image class="img1" src="../../public/img/xx.png"></image>
                    <Text class="text1">南方医科大学附属第三医院</Text>
                    <Text>120 人预约</Text>
                </View>
            </View> */}
            </View>
        </View>
    )
}
export default CheckPlace;